<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8" language="java"
	import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/page/base.jsp"%>
<%@ taglib prefix="d" uri="/doone-comm-ui-tags"%>
<html>
	<head>
		<title>留言板 管理</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
		<link type="text/css" href="<%=path%>/manage/css/layout.css"
			rel="stylesheet" />
		<link type="text/css" href="<%=path%>/manage/css/new_style.css"
			rel="stylesheet" />
		<link rel="stylesheet" type="text/css"
			href="<%=path%>/manage/css/Tooltip.css" />

		<script type="text/javascript"
			src="<%=path%>/manage/js/jquery-1.4.4.min.js"></script>

		<script type="text/javascript"
			src="<%=path%>/manage/js/easyTooltip.js"></script>
		<script type="text/javascript"
			src="<%=path%>/manage/js/jquery-ui-1.8.11.custom.min.js"></script>
		<script type="text/javascript"
			src="<%=path%>/manage/js/jquery.wysiwyg.js"></script>
		<script type="text/javascript"
			src="<%=path%>/manage/js/hoverIntent.js"></script>
		<script type="text/javascript" src="<%=path%>/manage/js/superfish.js"></script>
		<script type="text/javascript" src="<%=path%>/manage/js/custom.js"></script>
		<script type="text/javascript"
			src="<%=path%>/manage/js/My97DatePicker/WdatePicker.js"></script>

<%-- 验证js Start --%>
		<script type="text/javascript" src="<%=path%>/manage/js/Tooltip.js"></script>
		<script type="text/javascript"
			src="<%=path%>/manage/js/jquery.validate.min.js"></script>
		<script type="text/javascript"
			src="<%=path%>/manage/js/jquery.validate.methods.min.js"></script>
		<script type="text/javascript"
			src="<%=path%>/manage/js/jquery.validate.defaults.js"></script>
			<script type="text/javascript" src="<%=path%>/manage/js/errorTip.js"></script>
			
	</head>

	<script type="text/javascript">
	//用户编辑
	function editUser(intUserId) {
		$.ajax({
			url : root + '/manageUser/getManageUserById.action',
			method : 'post',
			dataType : 'json',
			data : {
				'intUserId' : intUserId
			},
			success : function(data) {
				//给form的文本赋值
				$("#varEnterpName").attr("value", data.varEnterpName);
				$("#varAppName").attr("value", data.varAppName);
				$("#varLoginName").attr("value", data.varLoginName);
				$("#varPhonenum").attr("value", data.varPhonenum);
				$("#varEmail").attr("value", data.varEmail);
				$("#intUserId").attr("value", data.intUserId);
				//打开dialog
				$("#userDialog").dialog("open");
			},
			error : function(err) {
				if (err.responseText != '')
					alert(err.responseText);
				else
					alert("请求失败！");
			}
		});

	}
	$(document).ready(function() {
		//留言检索处理
		$("#searchBtn").click(function() {
			$("#searchForm").submit();
		});
		//验证
		var userForm = $("#userForm").validate({
			rules : {
				"manageUserDto.varLoginName" : {
					required : true
				},
				"manageUserDto.varPasswordSame" : {
					equalTo : "#pwd"
				},
				"manageUserDto.varPassword" : {
					equalTo : "#pwdSame"
				},
				"manageUserDto.varEmail" : {
					email : true
				}

			},
			messages : {
				"manageUserDto.varLoginName" : {
					required : "用户名必填"
				},
				"manageUserDto.varPasswordSame" : {
					equalTo : "两次输入的密码不一致"
				},
				"manageUserDto.varPassword" : {
					equalTo : "两次输入的密码不一致"
				},
				"manageUserDto.varEmail" : {
					email : "请输入正确的电子邮件"
				}

			}
		});

		//加载dialog
		$("#userDialog").dialog({
			autoOpen : false,
			width : 600,
			height : 250,
			modal : true,
			title : '用户信息编辑',
			buttons : {
				"保存" : function() {
					$("#userForm").submit();
					$(this).dialog("close");
				},
				"取消" : function() {
					$(this).dialog("close");
					$("#userForm")[0].reset();
				}
			},
			close : function() {
				$("#userForm")[0].reset();
			}
		});
	});
</script>
	<body>
		<div>
			<p class="sitemap">
				当前位置：内容管理 > 用户管理
			</p>
			<h1>
				用户管理
			</h1>
			<div>

				<!-- Tabs -->
				<div id="tabs">
					<ul>
						<li>
							<a href="#tabs-1">后台用户列表</a>
						</li>

					</ul>
					<!-- 检索 -->

					<form name="searchForm" id="searchForm" method="post"
						action="<%=path%>/manageUser/getManageUserInfo.action"
						style="margin: 10px 0;">
						公司名称:
						<s:textfield name="condition.varEnterpName"></s:textfield>
						应用名称：
						<s:textfield name="condition.varAppName"></s:textfield>
						用户名：
						<s:textfield name="condition.varLoginName"></s:textfield>
						<input type="button" id="searchBtn" value="检索">
						<input type="reset" id="setBtn" value="重置">
					</form>


					<!-- 检索 END-->


					<table class="fullwidth" cellpadding="0" cellspacing="0" border="0">
						<thead>
							<tr>
								<td>
									公司名称
								</td>
								<td>
									应用名称
								</td>
								<td>
									用户名
								</td>
								<td>
									联系电话
								</td>
								<td>
									电子邮件
								</td>
								<td>
									操作
								</td>
							</tr>
						</thead>
						<tbody>
							<s:iterator value="userList">
								<tr class="odd">
									<td>
										<s:property value="varEnterpName" />
									</td>
									<td>
										<s:property value="varAppName" />
									</td>
									<td>
										<s:property value="varLoginName" />
									</td>
									<td>
										<s:property value="varPhonenum" />
									</td>
									<td>
										<s:property value="varEmail" />
									</td>
									<td>
										<a class="icon icon_edit" title="编辑"
											href="javascript:editUser('<s:property value="intUserId" />')"></a>
									</td>

								</tr>
							</s:iterator>
						</tbody>
					</table>

				</div>
				<div align="right" style="float: right;">
					<d:page id="page" template="details" skin="gray">
					</d:page>
				</div>
				<hr />
			</div>
		</div>


		<!-- 编辑页使用的弹出层 -->
		<div id="userDialog" style="display: none;">
			<form action="<%=path%>/manageUser/doEditManageUser.action"
				method="post" id="userForm">
				<s:hidden name="manageUserDto.intUserId" id="intUserId"></s:hidden>
				<table class="fullwidth" cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td>
							公司名称
						</td>
						<td>
							<s:textfield value="manageUserDto.varEnterpName"
								id="varEnterpName" readonly="true" />
						</td>
					</tr>
					<tr>
						<td>
							应用名称
						</td>
						<td>
							<s:textfield value="manageUserDto.varAppName" id="varAppName"
								readonly="true" />
						</td>
						<td>
							用户名
						</td>
						<td>
							<s:textfield name="manageUserDto.varLoginName" id="varLoginName"></s:textfield>
						</td>
					</tr>
					<tr>
						<td>
							密码
						</td>
						<td>
							<s:password name="manageUserDto.varPassword" id="pwd"></s:password>

						</td>
						<td>
							确认密码
						</td>
						<td>
							<s:password name="manageUserDto.varPasswordSame" id="pwdSame"></s:password>
						</td>
					</tr>
					<tr>
						<td>
							联系电话
						</td>
						<td>
							<s:textfield name="manageUserDto.varPhonenum" id="varPhonenum"></s:textfield>
						</td>
						<td>
							电子邮件
						</td>
						<td>
							<s:textfield name="manageUserDto.varEmail" id="varEmail"></s:textfield>
						</td>
					</tr>
				</table>

			</form>
		</div>


	</body>
</html>
